import request from "@/utils/request";
// import axios from 'axios'
import { apiVersion } from "@/config";

// 创建模型转换
export function addModelConvert(data) {
	return request({
		url: `/admin/${apiVersion}/modelConvert`,
		method: "post",
		data,
	});
}

// 创建模型转换
export function updataModelConvert(data) {
	return request({
		url: `/admin/${apiVersion}/modelConvert`,
		method: "put",
		data,
	});
}

// 获取列表
export function getModelConverts(data) {
	return request({
		url: `/admin/${apiVersion}/modelex/conModelPage`,
		method: "get",
		data,
	});
}

// 获取详情
export function getModelConvertDetail(data) {
	return request({
		url: `/admin/${apiVersion}/modelConvert/${data.id}`,
		method: "get",
	});
}

// 删除
export function delModelConvert(data) {
	return request({
		url: `/admin/${apiVersion}/modelConvert/del/${data.id}`,
		method: "delete",
		data,
	});
}

// 启动
export function startModelConvert(data) {
	return request({
		// url: `/admin/${apiVersion}/modelConvert/${data.id}/start`,
		url: `/admin/${apiVersion}/modelExConvert/${data.id}/start`,
		method: "put",
		data,
	});
}

/**
 * 获取podname
 * @param {*} data
 */
export function getModelConvertPodName(data) {
	return request({
		url: `/admin/${apiVersion}/modelConvert/${data.id}/podName`,
		noLoadding: true,
		method: "get",
	});
}

// 停止
export function stopModelConvert(data) {
	return request({
		url: `/admin/${apiVersion}/modelConvert/${data.id}/stop`,
		method: "put",
		data,
	});
}

// 获取模型
export function getAllmodelConvertbyModelVersion(data) {
	return request({
		url: `/admin/${apiVersion}/modelConvert/byModelVersion/${data.id}`,
		method: "get",
	});
}

/**
 * 获取模型转化指标或图示名称
 * @param {*} data
 */
export function metricKeys(data) {
	return request({
		url: `/admin/${apiVersion}/modelConvert/${data.id}/metric/keys`,
		noLoadding: true,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded",
		},
		method: "get",
		data,
	});
}

/**
 * 获取模型评转化标或图示数据详情
 * @param {*} data
 */
export function metricData(data) {
	return request({
		url: `/admin/${apiVersion}/modelConvert/${data.id}/metric/data`,
		noLoadding: true,
		headers: {
			"Content-Type": "application/x-www-form-urlencoded",
		},
		method: "get",
		data,
	});
}
